#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <signal.h>
struct sigaction act,oact;

void sigcb(int signo)
{
    printf("get signal : %d\n",signo);
    sigaction(2,&oact,NULL);
}

int main()
{
    //将两个结构体都置为零
    memset(&act,0,sizeof(act));
    memset(&oact,0,sizeof(oact));

    act.sa_handler = sigcb;
    act.sa_flags = 0;
    sigemptyset(&act.sa_mask);

    sigaction(2, &act, &oact);
	while (1){
		printf("I am a process...\n");
		sleep(1);
	}
    return 0;
}